@extends('shop::layouts.master')
@section('title')
    清除操作
@endsection
@section('tab')

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body ">
                        <a class="layui-btn" onclick="location.reload()">
                            <i class="layui-icon layui-icon-refresh"></i>
                        </a>
                    </div>
                    <div class="layui-card-body layui_overflow_y">

                        <table class="layui-table layui-form">
                            <thead>
                            <tr>
                                <th>视图缓存</th>
                                <th>菜单缓存</th>
                                <th>路由缓存</th>
                                <th>应用缓存</th>
                                <th>配置缓存</th>
                            </tr>
                            </thead>
                            <form class="layui-form" lay-filter="form_clear">
                                <tbody>
                                <tr>
                                    <td><input type="checkbox" name="clear[]" value="view" lay-skin="primary"></td>
                                    <td><input type="checkbox" name="clear[]" value="menu" lay-skin="primary"></td>
                                    <td><input type="checkbox" name="clear[]" value="route" lay-skin="primary"></td>
                                    <td><input type="checkbox" name="clear[]" value="cache" lay-skin="primary"></td>
                                    <td><input type="checkbox" name="clear[]" value="config" lay-skin="primary"></td>
                                </tr>
                                <tr>
                                    <td colspan="5"><button class="layui-btn" lay-filter="clear" lay-submit="">清除</button></td>
                                </tr>
                                </tbody>
                            </form>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('tab_js')
    <script>
        layui.use(['form', 'layer','jquery'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                    layer = layui.layer;

                //监听提交
                form.on('submit(clear)',
                    function(data) {
                        var $_url = '{{route('admin_index_clear_cache_operation')}}';
                        var $_data = data.field;
                        $.ajax({
                            url:$_url,
                            type:'delete',
                            data:$_data,
                            dataType : "json",
                            success:function(result){
                                if(result.state === 0){
                                    layer.msg("清除成功", {time:2000,icon: 6}, function() {
                                        //刷新当前页面
                                        location_refresh()
                                    });
                                }else{
                                    layer.msg(result.msg, {time:2000,icon: 5});
                                }

                            }});
                        return false;
                    });
            });
    </script>
@endsection




